package com.byxm.wlgw.service;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import com.byxm.wlgw.bean.GmpjBean;
import com.byxm.wlgw.common.DataBaseAccess;
import com.byxm.wlgw.query.GmpjQuery;

public class GmpjService {
	GmpjQuery gmpjQuery=new GmpjQuery();
	DataBaseAccess dba = null;	

	public List<GmpjBean> getGmpj(int spxxid){
		List<GmpjBean> list=new ArrayList<GmpjBean>();
		try {
			dba=new DataBaseAccess();
			PreparedStatement ps=dba.getPstmt(gmpjQuery.getGmpjAllSql());
			ps.setObject(1, spxxid);
			ResultSet rs = ps.executeQuery();
			while(rs.next()){
				GmpjBean gmpjBean=new GmpjBean();
				gmpjBean.setEmail(rs.getString("email"));
				gmpjBean.setPjnr(rs.getString("pjnr"));
				list.add(gmpjBean);
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			try {
				dba.releaseConnect();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return list;
	}
}
